﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using WfhTrader.Core.Quote;

namespace WfhTrader.Core.Trading
{
    public class PositionManager
    {
        /// <summary>
        /// 单例模式实例对象
        /// </summary>
        private static PositionManager instance;

        /// <summary>
        /// 持仓集合
        /// </summary>
        private Dictionary<string, Position> Positions = new Dictionary<string, Position>(100);

        /// <summary>
        /// 取得持仓管理类实例
        /// </summary>
        /// <returns>交易管理类实例</returns>
        public static PositionManager GetInstance()
        {
            if (instance == null)
                instance = new PositionManager();

            return instance;
        }

        /// <summary>
        /// 通过Key获取指定持仓信息
        /// </summary>
        /// <param name="id">持仓Key</param>
        /// <returns>持仓类</returns>
        public Position GetPositionByKey(string key)
        {
            return this.Positions.ContainsKey(key) ? this.Positions[key] : null;
        }

        public Position Create(string strategy, Account account, Security security, BarUnit barUnit, DirectionType directionType, ITrade iTrade)
        {
            return null;
        }
    }
}
